package cn.gson.crm.control.total;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.control.base.BaseServlet;
import cn.gson.crm.model.dao.RecordDao;
import cn.gson.crm.model.entity.ReceiptService;

/**
 * Servlet implementation class RecordServlet
 */
@WebServlet("/record")
public class RecordServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
	private RecordDao rd=new RecordDao();
       
	@Override
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String stuId=request.getParameter("stuid");
		//String totalStaffId=request.getParameter("totalStaffId");
		String p = request.getParameter("page");
		String staffName = request.getParameter("staffName");
		if (p == null || p.isEmpty()) {
			p = "1";
		}
		Integer page = Integer.parseInt(p);
		// 当前页数据
		List<ReceiptService> totalList = rd.getReceiptRecord(page, staffName,stuId);
		// 总页数
		int totalPage = rd.getTotalServicePage(staffName,stuId);
		request.setAttribute("queryString", noPageQueryString());
		request.setAttribute("totalList", totalList);
		request.setAttribute("totalPage", totalPage);
		request.setAttribute("page", page);
		request.setAttribute("stuId", stuId);
		//request.setAttribute("receiptRecordList", receiptRecordList);
		forward("total/record.jsp");
	}
}
